#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

void reverse(int* start, int* end)
{
    while (start < end)
    {
        int tmp = *start;
        *start = *end;
        *end = tmp;
        start++;
        end++;
    }
}

void rotate(int* nums, int numsSize, int k)
{
    k = k % numsSize;
    reverse(nums, nums + numsSize - 1 - k);
    reverse(nums + numsSize - k, nums + numsSize - 1);
    reverse(nums, nums + numsSize - 1);
}

int main()
{
    int arr[] = { 1,2,3,4,5,6,7 };
    int k = 3;
    rotate(arr, 7, 3);
	return 0;
}